package com.haobo.service.impl;

import com.haobo.dao.RoleDao;
import com.haobo.pojo.Role;
import com.haobo.service.RoleService;

import java.util.List;

/**
 * ClassName:RoleServiceImpl
 * Package:com.haobo.service.impl
 * Description:
 *
 * @Date:2021/5/28 18:19
 * @Author:haobo
 */
public class RoleServiceImpl implements RoleService {

    private RoleDao roleDao;
    public void setRoleDao(RoleDao roleDao) {
        this.roleDao = roleDao;
    }

    @Override
    public List<Role> list() {
        return roleDao.findAll();
    }

    @Override
    public void newRole(Role role) {
        roleDao.addRole(role);
    }

    @Override
    public void delRole(Long id) {
        roleDao.delUserRoleRel(id);
        roleDao.delRole(id);
    }
}
